# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoField do
  @moduledoc """
  Information about the value and type of the field.

  ## Attributes

  *   `cardinality` (*type:* `String.t`, *default:* `nil`) - By default, if the cardinality is unspecified the field is considered required while mapping.
  *   `defaultValue` (*type:* `GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoParameterValueType.t`, *default:* `nil`) - This holds the default values for the fields. This value is supplied by user so may or may not contain PII or SPII data.
  *   `fieldType` (*type:* `String.t`, *default:* `nil`) - Specifies the data type of the field.
  *   `protoDefPath` (*type:* `String.t`, *default:* `nil`) - Optional. The fully qualified proto name (e.g. enterprise.crm.storage.Account). Required for output field of type PROTO_VALUE or PROTO_ARRAY. For e.g., if input field_type is BYTES and output field_type is PROTO_VALUE, then fully qualified proto type url should be provided to parse the input bytes. If field_type is *_ARRAY, then all the converted protos are of the same type.
  *   `referenceKey` (*type:* `String.t`, *default:* `nil`) - This holds the reference key of the workflow or task parameter. 1. Any workflow parameter, for e.g. $workflowParam1$. 2. Any task input or output parameter, for e.g. $task1_param1$. 3. Any workflow or task parameters with subfield references, for e.g., $task1_param1.employee.id$
  *   `transformExpression` (*type:* `GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoTransformExpression.t`, *default:* `nil`) - This is the transform expression to fetch the input field value. for e.g. $param1$.CONCAT('test'). Keep points - 1. Only input field can have a transform expression. 2. If a transform expression is provided, reference_key will be ignored. 3. If no value is returned after evaluation of transform expression, default_value can be mapped if provided. 4. The field_type should be the type of the final object returned after the transform expression is evaluated. Scrubs the transform expression before logging as value provided by user so may or may not contain PII or SPII data.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cardinality => String.t() | nil,
          :defaultValue =>
            GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoParameterValueType.t() | nil,
          :fieldType => String.t() | nil,
          :protoDefPath => String.t() | nil,
          :referenceKey => String.t() | nil,
          :transformExpression =>
            GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoTransformExpression.t()
            | nil
        }

  field(:cardinality)

  field(:defaultValue,
    as: GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoParameterValueType
  )

  field(:fieldType)
  field(:protoDefPath)
  field(:referenceKey)

  field(:transformExpression,
    as: GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoTransformExpression
  )
end

defimpl Poison.Decoder, for: GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoField do
  def decode(value, options) do
    GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoField.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Integrations.V1.Model.EnterpriseCrmEventbusProtoField do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
